app.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider
  /*持证管理单位管理*/
  .state('require_certificate_organ', {
    url: '/require_certificate_organ',
    templateUrl: 'app/partials/require_certificate_organ/index.html',
    controller: function($scope,$modal,$location,RequireCertificateOrgan) {
      $scope.widget_title = '持证要求单位管理';
      $scope.require_certificate_organs = RequireCertificateOrgan.query();
      /* 删除 记录*/
      $scope.itemDelete = function(item){
        RequireCertificateOrgan.delete({},{"id": $scope.require_certificate_organs[item].name})
        $scope.require_certificate_organs.splice(item, 1); 
      }
   }
  })
  /*添加持证管理单位*/
  .state('require_certificate_organ.new', {
    url: '/new',
    templateUrl: 'app/partials/require_certificate_organ/form.html',
    controller: function($scope,$state,RequireCertificateOrgan) {
      $scope.widget_title = '添加持证要求单位';
      $scope.update = function(require_certificate_organ){
        RequireCertificateOrgan.save(require_certificate_organ,function(nr){
          $scope.require_certificate_organs.push(nr);
        });
        
        $scope.require_certificate_organ = {};
        $state.go('require_certificate_organ');
      }
   }
  })
})